cannot LoadModule mod_perl on apache2.2

cannot LoadModule mod_perl on apache2.2

am 20.04.2009 17:34:21 von Jeff Zhuk

--0-1444275943-1240241661=:9067
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hello!
=A0
I'd highly appreciate any help/advice on the following.
=A0
I installed mod_perl 2 on Apache 2.2 using the following:
=A0
>ppm install http://theoryx5.uwinnipeg.ca/ppms/mod_perl.ppd
====================
Install 'mod_perl' version 2.0.4 in ActivePerl 5.8.4.810.
====================
Installing C:\Perl\site\lib\auto\Apache2\typemap
Installing C:\Perl\site\lib\auto\Apache2\Access\Access.bs
.....
=A0
It was the first time install, so I don't think I need any renaming. Right?
=A0
I can see the mod_perl.so in the Apache/modules directory on windows XP.
=A0
I have 2 lines in the http.conf:
=A0
LoadFile "C:/Perl/bin/perl58.dll"
LoadModule perl_module modules/mod_perl.so
=A0
Apache doesn't want to start unless I comment the LoadModule line.
=A0
I don't see any specific error in the error.log (I think this log only star=
ts after Apache starts)
=A0
Any advice?
=A0
Thank you,
=A0
Jeff =0A
--0-1444275943-1240241661=:9067
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

top" style=3D"font: inherit;">
Hello!

 

I'd highly appreciate any help/advice on the following.

 

I installed mod_perl 2 on Apache 2.2 using the following:

 


====================
Instal=
l 'mod_perl' version 2.0.4 in ActivePerl 5.8.4.810.
=======
==============
Installing C:\Perl\site\lib\a=
uto\Apache2\typemap
Installing C:\Perl\site\lib\auto\Apache2\Access\Acce=
ss.bs

....

 

It was the first time install, so I don't think I need any renaming. R=
ight?

 

I can see the follow>mod_perl.so=
in the Apache/modules directory on 8505_3 style=3D"CURSOR: hand; BORDER-BOTTOM: #0066cc 1px dashed"> s=3Dyshortcuts id=3Dlw_1240158782_1 style=3D"CURSOR: hand; BORDER-BOTTOM: #=
0066cc 1px dashed"> URSOR: hand; BORDER-BOTTOM: #0066cc 1px dashed">windows XP
PAN>.

 

I have 2 lines in the http.conf:

 

LoadFile "C:/Perl/bin/perl58.dll"

LoadModule perl_module modules/mod_perl.so

 

Apache doesn't want to start unless I comment the LoadM=
odule line.

 

I don't see any specific error in the error.log (I thin=
k this log only starts after Apache starts)

 

Any advice?

 

Thank you,

 

Jeff

=

--0-1444275943-1240241661=:9067--

Re: cannot LoadModule mod_perl on apache2.2

am 21.04.2009 18:12:57 von aw

Jeff Zhuk wrote:
> Andre,
>
> Another thing that maybe related:
> I can start Apache without the line loading the mod_perl
> Then I would expect that my perl script will be executed.
>
> I have these lines in the httpd.conf:
>
> Alias /perl/ "C:/Tomcat/webapps"

Very bad !

>

Probably never even gets here.
I'd have to recheck when things happen between Alias and a Location, but
off the top of my head, I'd say that the first thing that happens is the
Alias, so it will never match the Location.

> SetHandler perl-script
> PerlResponseHandler ModPerl::Registry
> Options +ExecCGI
> PerlOptions +ParseHeaders
>

>
> But perl is not executed.
I see the source text instead (my scripts should produce html)
Of course.

>
> What do you think about this?
>
A whole lot, but not nice things.
The reason I say Very Bad above, is this :
Suppose you have an operational Tomcat on your system (which the above
line tends to indicate).
Then suppose you have a webapp under Tomcat :
TOMCAT_DIR/webapps/admin
and suppose that in the web.xml of that webapp is a very secret password.
Then by accessing you server via the URL "/perl/admin/WEB-INF/web.xml",
I can view/download that web.xml whenever I want.
(and any other file under your Tomcat webapps for that matter.
Never, ever give access to your Tomcat dirs via Apache that way, you
completely bypass any Tomcat security.

Move your perl scripts somewhere else entirely, not even directly under
the DocumentRoot of Apache either.
For example, move them to c:/Apache/perl.
Then do this
Alias /perl/ c:/apache/perl/

Order allow,deny
Allow from All
> SetHandler perl-script
> PerlResponseHandler ModPerl::Registry
> Options +ExecCGI
> PerlOptions +ParseHeaders


of course, this does not solve your problem loading mod_perl, but it
would be a first step.

Re: cannot LoadModule mod_perl on apache2.2

am 21.04.2009 20:38:38 von aw

Please, keep these messages on the list.

Jeff Zhuk wrote:
> Andre,
>
> 1.
> you are right about security. I actually have my JBoss running in a different space and only use this directory as static and perl root.
>
> I narrowed down the problem of running test.pl by directly providing the first line in the test.pl file:
>
> #!c:/Perl/bin/perl.exe
> ------------------------------------
> This made the trick and allowed the script to work with Apache.
> I have a lot of scripts and would not like to hardcode this line there.
> When I switch to mod_perl I'll need to replace this line with the pointer to perl58.dll or perl510.dll, right?
>

No, don't do that.

But maybe an additional word of explanation:

(Purists, I am simplifying, I know).

When you are running cgi-bin scripts without mod_perl, what happens is :
Apache uses the system default shell to run the script. The system shell
looks at the first line of the script, to determine which program should
run the script. Then the shell does an exec() of that program, with the
path of the script as argument.
This allows for cgi-bin scripts that are either perl, or any other
language (even a simple shell script).
This is all rather heavy and inefficient, because Apache has to start
another process, that process loads a shell, the shell then loads a
whole new perl interpreter, and that perl interpreter first compiles and
then runs your script. Then your script is done and exits, perl exits,
the additional process exits, and everything is forgotten.
And each time you call your script, the same happens again.
All in all, it is rather a wonder that it still works relatively fast.

When you run under mod_perl, the situation is fundamentally different.
First, Apache at startup will load a perl interpreter once and for all.
Then you tell Apache that in some directory, any files being run always
have to be run by that interpreter (that's what you do with "SetHandler
perl-script").
So Apache
1) does not have to load a new shell each time
2) this shell does not have to load perl
because perl is already there and Apache can tell it to run the script
file right away.
So only for that reason, things already go much faster.
For the sake of discussion, let's say that this already gains a factor
10 in speed, at least.

In addition, under some conditions perl will compile the script the
first time it runs it, and keep the compiled code cached in memory.
The next time the same script is run, perl can just re-execute the
cached compiled code.
That is much faster again.
Let's say that this is another cumulative factor 10.
So with both, you have a factor 10 X 10 = 100.

The next step would be to make, if possible and if it makes sense, your
script into a mod_perl Apache module. Then it would be loaded and
compiled when Apache starts, and become an integral part of Apache.
That would be another (smaller) boost in performance, but mainly it
allows you to write code that is much closer to the Apache "innards",
and that can directly intervene in the inner Apache request cycle, which
opens up lots of possibilities to do smart things like rewriting URLs,
doing customised authentication, filtering input and output, etc.. , all
of this quite fast.

That is the real power of mod_perl.
Apart from writing Apache add-on modules directly in C, mod_perl is the
closest you'll get to the Apache insides. Other languages don't even
come close (no matter what the php and python guys may believe).

And of course, lots of people have already done lots of things like
that, for just about any problem under the sun.
Have a look here for more ideas :
http://cpan.uwinnipeg.ca/search?query=apache2&mode=dist


> Any way to move this line to httpd.conf?
No, and you don't need to.
Or rather, it's already done.
As explained above, that is what the line "SetHandler perl-script" is
already doing for you.

>
> 2.
> I think, you are right again when you say that it has nothing to do with mod_perl loading.
> I suspect that my Perl install is not correct enough.
> Running Perl from the console I see some libraries missing.
> I think that while loading mod_perl, Apache cannot find some support from Perl.
>
> Do you think this might be the reason?
I have no idea, but since you are under Windows, it's not really hard to
re-install everything.

>
> I plan to re-install ActivePerl.
> Would you recommend 5.8 or 5.10?
>
Usually I would recommend the latest one available, but I am still
happily using mostly 5.8.
I recently had a couple of problems with 5.10 in a mod_perl context (had
to change a couple of lines somewhere in a script or mod_perl module)
but don't remember what exactly.
Try perl 5.10 first. You can always downgrade if you have a problem.
Following the procedure as indicated here is the easiest :
http://perl.apache.org/docs/2.0/os/win32/install.html#toc_PP M_Packages

- save your apache/conf directory somewhere
- de-install Apache and perl
- re-install Apache 2.2.x
- re-install perl 5.10 from Activestate
- run the ppm commands indicated
(ppm install http://theoryx5.uwinnipeg.ca/ppms/mod_perl.ppd)

If you need to get back prior configuration stuff, use your saved copy
of the apache/conf directory)

I strongly suggest that in the process of installing Apache, you pick a
sensible installation directory, without spaces in the name, like your
prior c:/apache. This will always save you some aggravation at some
point, and a lot of quotes always.
I can still not figure out why the Apache for Windows packagers decided
to follow the assinine MS customs.

Re: [OT] cannot LoadModule mod_perl on apache2.2

am 21.04.2009 21:02:07 von aw

André Warnier wrote:
>
> I strongly suggest that in the process of installing Apache, you pick a
> sensible installation directory, without spaces in the name, like your
> prior c:/apache. This will always save you some aggravation at some
> point, and a lot of quotes always.
> I can still not figure out why the Apache for Windows packagers decided
> to follow the assinine MS customs.
>
Come to think of it, that space between "Program" and "Files" has got to
be the most uselessly expensive nothing in the history of computing.

Re: cannot LoadModule mod_perl on apache2.2

am 22.04.2009 20:08:16 von Jeff Zhuk

--0-1912829844-1240423696=:10790
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Andre and Randy,
=A0
thank you for your advice.
I re-installed active perl 5.8.9 and this fixed the starting apache problem=
:=A0
Apache started OK with mod_perl
=A0
I still face the problem of running perl scripts.
=A0
When I point the browser to my 2 line test.pl, the browser opens the Downlo=
ad File dialog. When I select open it fires a MS shell window for a second =
and closes the window.
=A0
Here is the test.pl below:

print "Content-type: text/html\n\n";
print "Hello, World.";=20
=A0
Here are several lines from httpd.conf:
=A0
#AddHandler cgi-script .pl .ip # I tried each of these lines separately - s=
ame effect
SetHandler perl-script  =A0 # these instructions are on the global leve=
l, same effect inside a directory
=A0

Options Indexes FollowSymLinks ExecCGI=20
Order allow,deny
Allow from all


------------------------
Thank you for your help,
=A0
Jeff

--- On Mon, 4/20/09, Jeff Zhuk wrote:


From: Jeff Zhuk
Subject: cannot LoadModule mod_perl on apache2.2
To: modperl@perl.apache.org
Date: Monday, April 20, 2009, 9:34 AM







Hello!
=A0
I'd highly appreciate any help/advice on the following.
=A0
I installed mod_perl 2 on Apache 2.2 using the following:
=A0
>ppm install http://theoryx5.uwinnipeg.ca/ppms/mod_perl.ppd
====================
Install 'mod_perl' version 2.0.4 in ActivePerl 5.8.4.810.
====================
Installing C:\Perl\site\lib\auto\Apache2\typemap
Installing C:\Perl\site\lib\auto\Apache2\Access\Access.bs
.....
=A0
It was the first time install, so I don't think I need any renaming. Right?
=A0
I can see the mod_perl.so in the Apache/modules directory on windows XP.
=A0
I have 2 lines in the http.conf:
=A0
LoadFile "C:/Perl/bin/perl58.dll"
LoadModule perl_module modules/mod_perl.so
=A0
Apache doesn't want to start unless I comment the LoadModule line.
=A0
I don't see any specific error in the error.log (I think this log only star=
ts after Apache starts)
=A0
Any advice?
=A0
Thank you,
=A0
Jeff
=0A
--0-1912829844-1240423696=:10790
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

top" style=3D"font: inherit;">
Andre and Randy,

 

thank you for your advice.

I re-installed active perl 5.8.9 and this fixed the starting apache pr=
oblem: 

Apache started OK with mod_perl

 

I still face the problem of running perl scripts.

 

When I point the browser to my 2 line test.pl, the browser opens the D=
ownload File dialog. When I select open it fires a MS shell window for a se=
cond and closes the window.

 

Here is the test.pl below:

print "Content-type: text/html\n\n";

print "Hello, World.";

 

Here are several lines from httpd.conf:

 

#AddHandler cgi-script .pl .ip # I tried each of these lines separatel=
y - same effect

SetHandler perl-script    # these instructions are on t=
he global level, same effect inside a directory

 

<Directory "C:/myScripts">

Options Indexes FollowSymLinks ExecCGI

Order allow,deny

Allow from all

</Directory>


------------------------

Thank you for your help,

 

Jeff


--- On Mon, 4/20/09, Jeff Zhuk <jeff_zhuk@yahoo.com> I> wrote:

16,16,255) 2px solid">
From: Jeff Zhuk <jeff_zhuk@yahoo.com>
Su=
bject: cannot LoadModule mod_perl on apache2.2
To: modperl@perl.apache.o=
rg
Date: Monday, April 20, 2009, 9:34 AM






E>

Hello!

 

I'd highly appreciate any help/advice on the following.

 

I installed mod_perl 2 on Apache 2.2 using the following:

 


====================
Instal=
l 'mod_perl' version 2.0.4 in ActivePerl 5.8.4.810.
=======
==============
Installing C:\Perl\site\lib\a=
uto\Apache2\typemap
Installing C:\Perl\site\lib\auto\Apache2\Access\Acce=
ss.bs

....

 

It was the first time install, so I don't think I need any renaming. R=
ight?

 

I can see the follow>mod_perl.so=
in the Apache/modules directory on 8505_3 style=3D"CURSOR: hand; BORDER-BOTTOM: #0066cc 1px dashed"> s=3Dyshortcuts id=3Dlw_1240158782_1 style=3D"CURSOR: hand; BORDER-BOTTOM: #=
0066cc 1px dashed"> URSOR: hand; BORDER-BOTTOM: #0066cc 1px dashed">windows XP
PAN>.

 

I have 2 lines in the http.conf:

 

LoadFile "C:/Perl/bin/perl58.dll"

LoadModule perl_module modules/mod_perl.so

 

Apache doesn't want to start unless I comment the LoadM=
odule line.

 

I don't see any specific error in the error.log (I thin=
k this log only starts after Apache starts)

 

Any advice?

 

Thank you,

 

Jeff


--0-1912829844-1240423696=:10790--

Re: cannot LoadModule mod_perl on apache2.2

am 24.04.2009 05:59:59 von Randy Kobes

On Wed, Apr 22, 2009 at 1:08 PM, Jeff Zhuk wrote:
> Andre and Randy,
>
> thank you for your advice.
> I re-installed active perl 5.8.9 and this fixed the starting apache
> problem:
> Apache started OK with mod_perl
>
> I still face the problem of running perl scripts.
>
> When I point the browser to my 2 line test.pl, the browser opens the
> Download File dialog. When I select open it fires a MS shell window for a
> second and closes the window.

There's an entry in the FAQs for mod_perl on Win32:
http://perl.apache.org/docs/general/os/win32/faq.html
which suggests some things to look at for this problem.

--
best regards,
Randy